package com.lg.partition12;

import java.io.*;

/**
 * @author `RKC`
 * @date 2022/4/26 8:55
 */
public class P1197JSOI2008_星球大战 {

    private static final int N = 400010, M = N;
    private static int[] h = new int[N], e = new int[M], ne = new int[M];
    private static int[] parent = new int[N], broken = new int[N], ans = new int[N];
    private static boolean[] isBroken = new boolean[N];
    private static int n, m, k, idx = 0;

    private static StreamTokenizer tokenizer = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
    private static PrintWriter writer = new PrintWriter(new OutputStreamWriter(System.out));

    public static void main(String[] args) throws IOException {
        n = nextInt();
        m = nextInt();
        for (int i = 0; i <= n; i++) {
            h[i] = -1;
            parent[i] = i;
        }
        for (int i = 0; i < m; i++) {
            int a = nextInt(), b = nextInt();
            add(a, b);
            add(b, a);
        }
        k = nextInt();
        for (int i = 1; i <= k; i++) {
            //记录顺序并标记当前节点被摧毁
            broken[i] = nextInt();
            isBroken[broken[i]] = true;
        }
        int cnt = n - k;
        //枚举所有的边，如果两个端点都没被摧毁且所属的连通块不同，那么合并这两个节点，连通块的数量减少
        for (int i = 0; i < idx; i++) {
            int u = e[i], v = e[i ^ 1], fu = find(u), fv = find(v);
            if (!isBroken[u] && !isBroken[v] && fu != fv) {
                parent[fu] = fv;
                cnt--;
            }
        }
        ans[k + 1] = cnt;
        for (int i = k; i >= 1; i--) {
            int u = broken[i];
            cnt++;
            isBroken[u] = false;
            for (int j = h[u]; j != -1; j = ne[j]) {
                int v = e[j], fu = find(u), fv = find(v);
                if (!isBroken[v] && fu != fv) {
                    cnt--;
                    parent[fu] = fv;
                }
            }
            ans[i] = cnt;
        }
        for (int i = 1; i <= k + 1; i++) writer.println(ans[i]);
        writer.flush();
    }

    private static int find(int x) {
        if (x != parent[x]) parent[x] = find(parent[x]);
        return parent[x];
    }

    private static void add(int a, int b) {
        e[idx] = b;
        ne[idx] = h[a];
        h[a] = idx++;
    }

    private static int nextInt() throws IOException {
        tokenizer.nextToken();
        return (int) tokenizer.nval;
    }
}
